package edu.pku.sei.transformation.editor.views.figures;

import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.LineBorder;
import org.eclipse.draw2d.ToolbarLayout;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;

import edu.pku.sei.modeler.figures.CommonFigure;

public class ModelTypeFigure extends CommonFigure {
	public static final org.eclipse.swt.graphics.Color OBJECTNODE_COLOR = new Color(
			null, 175, 178, 239);
	protected Label nameLabel = new Label();
	protected Label tagLabel = new Label();
	protected Label contentLabel = new Label("");

	public ModelTypeFigure() {
		super();
		setLayoutManager(new ToolbarLayout());
		setOpaque(true);
		LineBorder border = new LineBorder(1);
		border.setColor(ColorConstants.blue);
		this.setBorder(border);
		tagLabel.setFont(FontConstant.STEREO_TYPE_LABEL);
		tagLabel.setText("<<head>>");
		add(tagLabel);
		
		nameLabel.setOpaque(false);
		nameLabel.setFont(FontConstant.ARIAL_8_B);
		nameLabel.setForegroundColor(ColorConstants.black);
		nameLabel.setBackgroundColor(ColorConstants.white);
	//	nameLabel.setIcon(IconsProvider.getImage(IconsProvider.MODEL_ICON));

		add(nameLabel);
		
		contentLabel.setBorder(new ContainerBorder(OBJECTNODE_COLOR, 1, 1, 1,
				1, 1));
		add(contentLabel);
	}

	public void setName(String name) {
		nameLabel.setText(name);
	}
	
	public void setTag(String tag) {
		tagLabel.setText(tag);
	}

	public void setBounds(Rectangle rect) {
		super.setBounds(rect);
	}
	
	public void setNameLabelIcon(Image image) {
		this.nameLabel.setIcon(image);
	}
	
	public void setContent(String s) {
		this.contentLabel.setText(s);
	}
}
